import VueRouter from 'vue-router'

//引入组件
import Index from '../pages'
import Home from '../pages/home/home'
import Login from '../pages/login/login'
import Register from '../pages/register/register'
import Center from '../pages/center/center'
import News from '../pages/news/news-list'
import NewsDetail from '../pages/news/news-detail'
import gongzuorenyuanList from '../pages/gongzuorenyuan/list'
import gongzuorenyuanDetail from '../pages/gongzuorenyuan/detail'
import gongzuorenyuanAdd from '../pages/gongzuorenyuan/add'
import shangpinfenleiList from '../pages/shangpinfenlei/list'
import shangpinfenleiDetail from '../pages/shangpinfenlei/detail'
import shangpinfenleiAdd from '../pages/shangpinfenlei/add'
import gongyingshangList from '../pages/gongyingshang/list'
import gongyingshangDetail from '../pages/gongyingshang/detail'
import gongyingshangAdd from '../pages/gongyingshang/add'
import shangpinxinxiList from '../pages/shangpinxinxi/list'
import shangpinxinxiDetail from '../pages/shangpinxinxi/detail'
import shangpinxinxiAdd from '../pages/shangpinxinxi/add'
import yuanliaosuyuanList from '../pages/yuanliaosuyuan/list'
import yuanliaosuyuanDetail from '../pages/yuanliaosuyuan/detail'
import yuanliaosuyuanAdd from '../pages/yuanliaosuyuan/add'
import shengchansuyuanList from '../pages/shengchansuyuan/list'
import shengchansuyuanDetail from '../pages/shengchansuyuan/detail'
import shengchansuyuanAdd from '../pages/shengchansuyuan/add'
import cangchusuyuanList from '../pages/cangchusuyuan/list'
import cangchusuyuanDetail from '../pages/cangchusuyuan/detail'
import cangchusuyuanAdd from '../pages/cangchusuyuan/add'
import wuliusuyuanList from '../pages/wuliusuyuan/list'
import wuliusuyuanDetail from '../pages/wuliusuyuan/detail'
import wuliusuyuanAdd from '../pages/wuliusuyuan/add'
import systemintroList from '../pages/systemintro/list'
import systemintroDetail from '../pages/systemintro/detail'
import systemintroAdd from '../pages/systemintro/add'

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}

//配置路由
export default new VueRouter({
	routes:[
		{
      path: '/',
      redirect: '/index/home'
    },
		{
			path: '/index',
			component: Index,
			children:[
				{
					path: 'home',
					component: Home
				},
				{
					path: 'center',
					component: Center,
				},
				{
					path: 'news',
					component: News
				},
				{
					path: 'newsDetail',
					component: NewsDetail
				},
				{
					path: 'gongzuorenyuan',
					component: gongzuorenyuanList
				},
				{
					path: 'gongzuorenyuanDetail',
					component: gongzuorenyuanDetail
				},
				{
					path: 'gongzuorenyuanAdd',
					component: gongzuorenyuanAdd
				},
				{
					path: 'shangpinfenlei',
					component: shangpinfenleiList
				},
				{
					path: 'shangpinfenleiDetail',
					component: shangpinfenleiDetail
				},
				{
					path: 'shangpinfenleiAdd',
					component: shangpinfenleiAdd
				},
				{
					path: 'gongyingshang',
					component: gongyingshangList
				},
				{
					path: 'gongyingshangDetail',
					component: gongyingshangDetail
				},
				{
					path: 'gongyingshangAdd',
					component: gongyingshangAdd
				},
				{
					path: 'shangpinxinxi',
					component: shangpinxinxiList
				},
				{
					path: 'shangpinxinxiDetail',
					component: shangpinxinxiDetail
				},
				{
					path: 'shangpinxinxiAdd',
					component: shangpinxinxiAdd
				},
				{
					path: 'yuanliaosuyuan',
					component: yuanliaosuyuanList
				},
				{
					path: 'yuanliaosuyuanDetail',
					component: yuanliaosuyuanDetail
				},
				{
					path: 'yuanliaosuyuanAdd',
					component: yuanliaosuyuanAdd
				},
				{
					path: 'shengchansuyuan',
					component: shengchansuyuanList
				},
				{
					path: 'shengchansuyuanDetail',
					component: shengchansuyuanDetail
				},
				{
					path: 'shengchansuyuanAdd',
					component: shengchansuyuanAdd
				},
				{
					path: 'cangchusuyuan',
					component: cangchusuyuanList
				},
				{
					path: 'cangchusuyuanDetail',
					component: cangchusuyuanDetail
				},
				{
					path: 'cangchusuyuanAdd',
					component: cangchusuyuanAdd
				},
				{
					path: 'wuliusuyuan',
					component: wuliusuyuanList
				},
				{
					path: 'wuliusuyuanDetail',
					component: wuliusuyuanDetail
				},
				{
					path: 'wuliusuyuanAdd',
					component: wuliusuyuanAdd
				},
				{
					path: 'systemintro',
					component: systemintroList
				},
				{
					path: 'systemintroDetail',
					component: systemintroDetail
				},
				{
					path: 'systemintroAdd',
					component: systemintroAdd
				},
			]
		},
		{
			path: '/login',
			component: Login
		},
		{
			path: '/register',
			component: Register
		},
	]
})
